﻿@model LetLord.ViewModels.GenericSearchResultsViewModel<LetLord.Models.ResidentialProperty>

@if (Model.SearchResults.Count == 0)
{
    <h3 class="text-error">No properties matched your search!</h3>
}
else
{
    foreach (var result in Model.SearchResults)
    {
    <div class="result-container">
        <div class="span3">
            @if (result.PropertyPhotos.Count == 0)
            {
                <img class=" img-rounded" src="~/Images/noImage.jpg" />
            }
            else
            {
                <img class=" img-rounded" src="@Url.Action("GetPhotos", "Landlords", new { id = result.PropertyPhotos.First().ImageId })" alt="" />
            }
        </div>
        <div class="span2 summary">
            <div class="address">
                @result.Address.TownCity<br />@result.Address.County
            </div>
            <div>
                @result.NumberOfBedrooms Bedrooms
            </div>
            <div>
                @result.NumberOfBathrooms Bathrooms
            </div>
        </div>
        <div class="span4 description">
            @result.Description
        </div>
        <div class="span3">
            <h4 class="price">€@result.MonthlyRate Monthly
            
            </h4>
            <button class="btn btn-primary btn-block show-modal" data-id="@result.ResidentialPropertyId" >More info</button>
        </div>
    </div>
    }
    <div class="modal hide fade in" id="modal-view-property-from-search" data-url="ResidentialProperties/ViewProperty">
        <div id="view-property-from-search-container"></div>
    </div>
}
